const allHref = window.location.href;

const api = (() => {
  // 接口
  if (allHref.indexOf("tmc.himyidea.com") !== -1) {
    return "https://tmc.himyidea.com";
  } else if (allHref.indexOf("www.himyidea.com") !== -1) {
    return "https://www.himyidea.com";
  } else if (allHref.indexOf("test.changfunfly.com") !== -1) {
    return "http://test.changfunfly.com";
  } else if (allHref.indexOf("www.changfunfly.com") !== -1) {
    return "https://www.changfunfly.com";
  } else {
    return "http://test.himyidea.com";
  }
})();

const urlApi = (() => {
  // 页面跳转
  if (allHref.indexOf("tmc.himyidea.com") !== -1) {
    return "https://tmc.himyidea.com/pc/#/";
  } else if (allHref.indexOf("test.himyidea.com") !== -1) {
    return "http://test.himyidea.com/pc/#/";
  } else if (allHref.indexOf("test.changfunfly.com") !== -1) {
    return "http://test.changfunfly.com/pc/#/";
  } else if (allHref.indexOf("www.changfunfly.com") !== -1) {
    return "https://www.changfunfly.com/pc/#/";
  } else {
    // return "http://localhost:8080/#/";
    return "http://localhost:8081/#/";
  }
})();

export { api, urlApi };
